package com.yh.vote.interceptors;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.yh.vote.entity.VoteUser;

/**
 * 
  * AuthorizationInterceptor class
  * Description: 用于拦截网页，看网页是否已登�?
  * Company: 
  *
  * @author MasterGu
  * @date 2017-11-19 6:50:24 PM
 */
public class AuthorizationInterceptor extends AbstractInterceptor{

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Map<String, Object> session = invocation.getInvocationContext().getSession() ;
		VoteUser user = (VoteUser)session.get("vu") ;
		if (user == null) {
			return "toLogin" ;
		} else {
			//继续执行
			return invocation.invoke();
		}
	}

}
